﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.XLANGs.BaseTypes;

namespace BizMock
{
    public sealed class MapVerifier
    {
        public static bool Verify(string[] files, TransformBase map, MessageVerifierBase verifier)
        {
            foreach (string inputFile in files)
            {
                try
                {
                    Expect.Message(inputFile).TransformedWith(map).Verify(verifier);
                }
                catch
                {
                    return false;
                }
            }
            return true;
        }

        public static bool Verify( string file, TransformBase map, MessageVerifierBase verifier)
        {
            return Verify( new string[] { file }, map, verifier );
        }
    }

    public sealed class MessageVerifier
    {
        public static bool Verify( string[] files, MessageVerifierBase verifier )
        {
            foreach (string inputFile in files)
            {

                try
                {
                    Expect.Message(inputFile).Verify(verifier);
                }
                catch
                {
                    return false;
                }
            }
            return true;
        }

        public static bool Verify(string file, MessageVerifierBase verifier)
        {
            return Verify(new string[] { file }, verifier);
        }
    }
}
